<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	response.CacheControl = "no-cache"
	
	Dim oRSAlumnos
	Dim IdCurso, FnoF, IdQuincena
	
	IdCurso = request("IdCurso")
	FnoF = request("FnoF")
	IdQuincena = request("IdQuincena")
	
	'response.Write IdCurso & FnoF & IdQuincena
	'response.End
	
	Set oRSAlumnos = GetAlumnosFirmas(IdCurso, FnoF, IdQuincena)
	%>
	<table cellpadding=0 cellspacing=0 width=100% height=100% style="border-collapse: collapse; font-family: Verndana; font-size: 12px; font-weight: bold; color: white;">
		<tr valign="top">
			<td style="background-color: #666666; width: 250px; height: 15px;">Apellido y Nombre</td>
			<td style="background-color: #666666; text-align: center;">Curso</td>
			<td style="background-color: #666666; text-align: center;">Plan.</td>
			<td style="background-color: #666666; text-align: center; width:20;"></td>
		</tr>
		<tr valign="top">
			<td colspan=5>
				<div style="height: 300px; overflow-Y: scroll;">
		<table cellpadding=0 cellspacing=0 width=100% style="border-collapse: collapse; font-family: Verndana; font-size: 12px;">
		<%
			while not oRSAlumnos.EOF
				response.Write "<tr>"
				response.Write "<td width=250 height=25>" & oRSAlumnos("Apellido") & ", " & oRSAlumnos("Nombre") & "</td>"
				response.Write "<td style=""text-align: center;"">" & oRSAlumnos("CursoDescrip") & "</td>"
				response.Write "<td></td>"
				response.Write "</tr>"
				
				oRSAlumnos.MoveNext()
			wend
		%>
		</table>
		</div>
		</td>
		</tr>
		
	</table>
<%
Public function GetAlumnosFirmas(IdCurso, FnoF, IdQuincena)

	Dim oConn, sSQL, oRS, str, i, aux
	
	if cint(FnoF) = 0 then
		str = "not"
	end if
	
	Set oConn = OpenConnection

	sSQL=	"select distinct A.*, MC.idSedeCurso, C.CursoDescrip " & _
			"from Alumno A " & _
			"inner join AlumnoCurso AC on (A.idAlumno=AC.idAlumno) " & _
			"inner join MateriaCurso MC on (MC.idMateriaCurso = AC.idMateriaCurso) " & _
			"inner join Curso C on (C.IdCurso = MC.IdSedeCurso and MC.IdSedeCurso = " & IdCurso & ") "
	if cint(FnoF) <> 2 then
		sSQL = sSQL & "where A.IdAlumno " & str & " in (select IdAlumno from PlanillasFirmadas where IdColegioQuincena = " & IdQuincena & " group by IdAlumno, IdColegioQuincena having count(*) = 2) "
	end if
	
	sSQL = sSQL & "order by A.Apellido"
	
	'response.Write sSQL
	'response.End
	
	Set oRS = oConn.Execute(sSQL)
	Set GetAlumnosFirmas = oRS
End function

%>